<?php
namespace App\Service;

use App\Models\Shop\Good;

class ShopService {
    # 搜索
    public function search($limit, $search,$classId)
    {
        $data = Good::query()
            ->when($classId,function($query, $classId){
                $query->where('class_id', $classId);
            })
            ->when($search,function ($query, $search){
                $query->where('name','like',"%{$search}%");
            })
            ->paginate($limit);
        return $data;
    }

}
